Connecting to the Web Reports Server

The Web Reports Server provides not only a powerful means of distributing reports across the web, but also provides a report distribution mechanism that can be incorporated into multi-tier applications. By using the Crystal Report Viewer for ActiveX as a client-side report viewer, the Web Reports Server can become a report distribution engine within a larger application that runs over a network.

Connecting to the Web Reports Server requires accessing two new ActiveX components: the WebReportBroker and the WebReportSource. The following samples demonstrate how to connect to the Web Reports Server using Connecting from Visual Basic, and Connecting from VBScript, inside a web page.

Connecting from Visual Basic

The following code is an example of how to connect to the Web Reports Server from Visual Basic and assign a report to the Crystal Report Viewer for ActiveX. This assumes that you have added the ActiveX viewer control to a form named Form1, and the ActiveX viewer control is named CRViewer1.

Private Sub Form1_Load()
    Dim webBroker, webSource
    Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
    Set webSource = CreateObject("WebreportSource.WebReportSource")     webSource.ReportSource = webBroker
    webSource.URL = "http://<machinename>/scrreports/xtreme/hr.rpt"
    webSource.Title = "Employee Profiles"     CRViewer1.ReportSource = webSource
    CRViewer1.ViewReport End Sub
Connecting from VBScript

The following code assumes you have added the Crystal Report Viewer for ActiveX to a web page using the <OBJECT> tag and assigned it an ID of CRViewer.

<OBJECT ID="WebSource" Width=0 Height=0>
    CLASSID="CLSID:F2CA2115-C8D2-11D1-BEBD-00A0C95A6A5C"
    CODEBASE="viewer/ActiveXViewer/swebrs.dll#Version=1.2.0.5"
</OBJECT> <OBJECT ID="WebBroker" Width=0 Height=0>
    CLASSID="CLSID:F2CA2119-C8D2-11D1-BEBD-00A0C95A6A5C"
    CODEBASE="viewer/ActiveXViewer/swebrs.dll#Version=1.2.0.5"
</OBJECT> <OBJECT ID="Export" Width=0 Height=0>
    CLASSID="CLSID:BD10A9C1-07CC-11D2-BEFF-00A0C95A6A5C"
    CODEBASE="viewer/ActiveXViewer/sviewhlp.dll#Version=1.0.0.4"
</OBJECT> <SCRIPT LANGUAGE="VBScript">
<!--
Sub Page_Initialize
    Dim webBroker
    Dim webSource
    Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
    Set webSource = CreateObject("WebReportSource.WebReportSource")
    webSource.ReportSource = webBroker
    webSource.URL = Location.Protocol + "//" + Location.Host + _
        "/scrreports/xtreme/invent.rpt"
    CRViewer.ReportSource = webSource
    CRViewer.ViewReport
End Sub
-->
</SCRIPT>


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com